// Learn cc.Class:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {
        boss:{
            type:cc.Node,
            default:null,
        },
        Label:{
            type:cc.Node,
            default:null,
        },
        point:[cc.Node],
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },
    setNumber(num){

        let lab = this.Label.getComponent(cc.Label);
        lab.string = num;

    },
    //设置boss关卡
    setBoss(num){
        if(num%3 === 0){
            this.boss.opacity = 255;
        } else{
            this.boss.opacity = 0;
        }
    },
    setIndex(index){
        this.index = index;
    },
    setPointShow(){
        if(this.index===1){
            this.point[0].opacity = 255;
            this.point[1].opacity = 0;

        } else if(this.index===2){
            this.point[0].opacity = 0;
            this.point[1].opacity = 255;
        } else{
            this.point[0].opacity = 0;
            this.point[1].opacity = 0;
        }
    },
    playPoint(i){
        if(i===-1){ //全部淡出
            this.point[0].runAction(cc.fadeOut(0.5));
            this.point[1].runAction(cc.fadeOut(0.5));
        } else if(i === 0){ // 》==0
            this.point[0].runAction(cc.fadeIn(0.5));
            this.point[1].runAction(cc.fadeOut(0.5));
            

        } else if(i===1){ // 0==》
            this.point[0].runAction(cc.fadeOut(0.5));
            this.point[1].runAction(cc.fadeIn(0.5));
        }
    },
    // update (dt) {},
});
